From 0b932f953fe134be2e04139b8037237257f96910 Mon Sep 17 00:00:00 2001 From: Jimi Xenidis Date: Thu, 21 Sep 2006 07:37:00 -0400 Subject: [PATCH] [XEN][POWERPC] Fully inline udelay() Signed-off-by: Jimi Xenidis Signed-off-by: Hollis Blanchard --HG-- extra : transplant_source : %BC%B5%99%8A%0A%BCP%A3l%B8%00%B8C%CE49R%CC%CBf --- xen/arch/powerpc/Makefile | 1 - xen/arch/powerpc/delay.c | 37 --------------------------------- xen/include/asm-powerpc/delay.h | 17 +++++++++++++-- 3 files changed, 15 insertions(+), 40 deletions(-) delete mode 100644 xen/arch/powerpc/delay.c diff --git a/xen/arch/powerpc/Makefile b/xen/arch/powerpc/Makefile index 5db65c2c7c..6381e031ba 100644 --- a/xen/arch/powerpc/Makefile +++ b/xen/arch/powerpc/Makefile @@ -12,7 +12,6 @@ obj-y += boot_of.o obj-y += dart.o obj-y += dart_u3.o obj-y += dart_u4.o -obj-y += delay.o obj-y += domctl.o obj-y += domain_build.o obj-y += domain.o diff --git a/xen/arch/powerpc/delay.c b/xen/arch/powerpc/delay.c deleted file mode 100644 index e83b687dce..0000000000 --- a/xen/arch/powerpc/delay.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#include -#include -#include -#include - -void udelay(unsigned long usecs) -{ - ulong ticks = usecs * ticks_per_usec; - ulong s; - ulong e; - - s = get_timebase(); - do { - asm volatile("or 1,1,1"); /* also puts the thread to low priority */ - e = get_timebase(); - } while ((e-s) < ticks); -} diff --git a/xen/include/asm-powerpc/delay.h b/xen/include/asm-powerpc/delay.h index f6dcde95ad..898528ed84 100644 --- a/xen/include/asm-powerpc/delay.h +++ b/xen/include/asm-powerpc/delay.h @@ -13,16 +13,29 @@ * along with this program; if not, write to the Free Software * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (C) IBM Corp. 2005 + * Copyright (C) IBM Corp. 2005, 2006 * * Authors: Hollis Blanchard + * Jimi Xenidis */ #ifndef _ASM_DELAY_H_ #define _ASM_DELAY_H_ +#include + extern unsigned long ticks_per_usec; #define __udelay udelay -extern void udelay(unsigned long usecs); +static inline void udelay(unsigned long usecs) +{ + unsigned long ticks = usecs * ticks_per_usec; + unsigned long s; + unsigned long e; + s = get_timebase(); + do { + asm volatile("or 1,1,1"); /* also puts the thread to low priority */ + e = get_timebase(); + } while ((e-s) < ticks); +} #endif -- 2.30.2